/**
 * 20190319@JAR:
 * 
 * 1.汉化字典'cnItems:obj',
 * 2.采集新词'cnItem:fun';
 * 
 */

//1.汉化杂项
var cnItems = {
    _STYLE_: [
        '符号', '待归类', '地图', '防具', '武器', '道具', '属性', '敌人'
    ],
    _OTHER_: [],

    //1.0.符号
    '': '',
    '---': '———',

    //1.1.待归类
    'All profit x11!': '所有利润 x11 !',
    'All profit x13!': '所有利润 x13 !',
    'All profit x15!': '所有利润 x15 !',
    'All profit x2!': '所有利润 x2 !',
    'All profit x3!': '所有利润 x3 !',
    'All profit x3.1415926': '所有利润 x3.1415926 !',
    'All profit x5!': '所有利润 x5 !',
    'All profit x7!': '所有利润 x7 !',
    'All profit x9!': '所有利润 x9 !',
    'Bank': '银行',
    'bank profit x11!': '银行利润 x11 !',
    'Bank profit x3!': '银行利润 x3 !',
    'Bank profit x7!': '银行利润 x7 !',
    'car profit x2!': '汽车利润 x2 !',
    'car profit x3!': '汽车利润 x3 !',
    'car profit x4!': '汽车利润 x4 !',
    'car profit x5!': '汽车利润 x5 !',
    'car profit x6!': '汽车利润 x6 !',
    'car profit x7!': '汽车利润 x7 !',
    'Car-Wash': '洗车',
    'Car-wash profit x3!': '洗车利润 x3 !',
    'Car-wash profit x7!': '洗车利润 x7 !',
    'Cave Johnson (Lemonade Stand Manager)': '凯夫·约翰逊(柠檬水摊经理)',
    'Dark Lord (Bank Manager)': '黑魔王(银行经理)',
    'Derrick (Oil Company Manager)': '德里克(石油公司经理)',
    'donut profit x2!': '甜甜圈利润 x2 !',
    'donut profit x3!': '甜甜圈利润 x3 !',
    'donut profit x4!': '甜甜圈利润 x4 !',
    'donut profit x5!': '甜甜圈利润 x5 !',
    'donut profit x6!': '甜甜圈利润 x6 !',
    'donut profit x7!': '甜甜圈利润 x7 !',
    'Donut Shop': '甜甜圈店',
    'Donut shop profit x3!': '甜甜圈店利润 x3 !',
    'Donut shop profit x7!': '甜甜圈店利润 x7 !',
    'Down Cheri (Hockey Team Manager)': '唐彻里(曲棍球队经理)',
    'Forest Shrump (Shrimp Boat Manager)': '森林尖锋(捕虾船经理)',
    'hockey profit x11!': '曲棍球利润 x11 !',
    'hockey profit x7!': '曲棍球利润 x7 !',
    'Hockey Team': '曲棍球队',
    'Hockey team profit x3!': '曲棍球队利润 x3 !',
    'Hockey team profit x7!': '曲棍球队利润 x7 !',
    'Jim (Donut Shop Manager)': '吉姆(甜甜圈店经理)',
    'lemonade profit x2!': '柠檬水利润 x2 !',
    'lemonade profit x4!': '柠檬水利润 x4 !',
    'lemonade profit x5!': '柠檬水利润 x5 !',
    'lemonade profit x6!': '柠檬水利润 x6 !',
    'lemonade profit x7!': '柠檬水利润 x7 !',
    'Lemonade Stand': '柠檬水摊',
    'Lemonade stand profit x3!': '柠檬水摊利润 x3!',
    'Lemonade stand profit x7!': '柠檬水摊利润 x7!',
    'Magic Up 1 : all profit x3!': '魔力1:全体利润 x3 !',
    'Magic Up 10 : all profit x3!': '魔力10:全体利润 x3 !',
    'Magic Up 11 : all profit x5!': '魔力11:全体利润 x5 !',
    'Magic Up 12 : all profit x3!': '魔力12:全体利润 x3 !',
    'Magic Up 2 : tokens rate +2%!': '魔力2:筹码几率 +2% !',
    'Magic Up 3 : tokens rate +2%!': '魔力3:筹码几率 +2% !',
    'Magic Up 4 : all profit x5!': '魔力4:全体利润 x5 !',
    'Magic Up 5 : all profit x9!': '魔力5:全体利润 x9 !',
    'Magic Up 6 : all profit x11': '魔力6:全体利润 x11 !',
    'Magic Up 7 : all profit x15': '魔力7:全体利润 x15 !',
    'Magic Up 8 : tokens rate +10%!': '魔力8:筹码几率 +10% !',
    'Magic Up 9 : all profit x15!': '魔力9:全体利润 x15 !',
    'Mama Sean (Pizza Delivery Manager)': '妈妈肖恩(披萨外卖经理)',
    'movie profit x11!': '电影利润 x11 !',
    'movie profit x7!': '电影利润 x7 !',
    'Movie Studio': '电影制片厂',
    'Movie studio profit x3!': '电影制片厂利润 x3 !',
    'Movie studio profit x7!': '电影制片厂利润 x7 !',
    'Newspaper profit x3!': '报纸利润 x3 !',
    'Newspaper Stand': '报摊',
    'Newspaper stand profit x3!': '报摊利润 x3 !',
    'Newspaper stand profit x7!': '报摊利润 x7 !',
    'newspaper x7777777!': '报纸 x7777777 !',
    'Oil Company': '石油公司',
    'Oil company profit x3!': '石油公司利润 x3 !',
    'Oil company profit x7!': '石油干啥利润 x7 !',
    'oil profit x11!': '石油利润 x11 !',
    'Pizza Delivery': '披萨外卖',
    'Pizza delivery profit x3!': '披萨外卖利润 x3 !',
    'Pizza delivery profit x7!': '披萨外卖利润 x7 !',
    'pizza profit x2!': '披萨利润 x2 !',
    'pizza profit x3!': '披萨利润 x3 !',
    'pizza profit x4!': '披萨利润 x4 !',
    'pizza profit x5!': '披萨利润 x5 !',
    'pizza profit x6!': '披萨利润 x6 !',
    'pizza profit x7!': '披萨利润 x7 !',
    'profit of all x2!': '全体利润 x2 !',
    'profit x2!': '利润 x2 !',
    'profit x3!': '利润 x3 !',
    'profit x4!': '利润 x4 !',
    'profit x5!': '利润 x5 !',
    'profit x9!': '利润 x9 !',
    'Rupert Murdoch (Newspaper Stand Manager)': '鲁珀特·默多克(报摊经理)',
    'Shrimp Boat': '捕虾船',
    'Shrimp boat profit x3!': '捕虾船利润 x3 !',
    'Shrimp boat profit x7!': '捕虾船利润 x7 !',
    'shrimp profit x11!': '虾利润 x11 !',
    'shrimp profit x7!': '虾利润 x7 !',
    'speed of all x2!': '全局速度 x2 !',
    'speed x2!': '速度 x2!',
    'Spielberg (Movie Studio Manager': '斯皮尔伯格(电影制片人经理)',
    'spped x2!': '速度 x2!',
    'tokens efficiency +1%': '筹码效果 +1%',
    'tokens efficiency +2%': '筹码效果 +2%',
    'W.W. Heisenberg (Car-Wash Manager)': '海森堡(洗车经理)',
    '25 lemonade stand': '25 柠檬弹',
    '': '',

    //1.2.地图
    '': '',
    '': '',

    //1.3.防具
    //1.4.武器
    //1.5.道具

    //1.6.属性（30）
    '': '',

    //1.7.敌人 

};
//2.采集新词
//20190320@JAR

var cnItem = function () {

    //传参是否非空字串
    if (!arguments[0]) return;

    //检验传参是否对象
    let text = arguments[0],
        s = '';
    if (typeof (text) != "string")
        return text;
    else
        s = arguments[0].charCodeAt();

    //检验传参是否英文
    if (
        s < 65 || (s > 90 && s < 97) || (s > 122)

    ) return text;
    //检验字典是否可存
    if (!cnItems._OTHER_) cnItems._OTHER_ = [];

    //遍历尝试匹配
    for (let i in cnItems) {
        //字典已有词汇或译文、且译文不为空，则返回译文
        if (
            text == i || text == cnItems[i] &&
            cnItems[i] != ''
        )
            return cnItems[i];
    }

    //遍历生词表是否收录
    for (
        let i = 0; i < cnItems._OTHER_.length; i++
    ) {
        //已收录则直接返回
        if (text == cnItems._OTHER_[i])
            return text;
    }

    //未收录则保存
    cnItems._OTHER_.push(text);
    cnItems._OTHER_.sort(
        function (a, b) {
            return a.localeCompare(b)
        }
    );

    /*
        //开启生词打印
        //console.log(
            '有需要汉化的英文：', text
        );
    */

    //返回生词字串
    return text;
};
